<!DOCTYPE html>
<html lang="en">
<script language="JavaScript" src="../../js/jquery.js" type=""></script>
<head>
    <meta charset="UTF-8">
    <title>feedbackStatistics</title>
    <script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
</head>
<link rel="stylesheet" type="text/css" href="../../css/dataTables.bootstrap.css" />
<link rel="stylesheet" type="text/css" href="../../css/bootstrap.min.css"/>
<link href="../../css/style.css" rel="stylesheet" type="text/css" />
<body onload="init()" style="position:relative; width: 100%; height: 100%;">
<div class="tools">

    <ul class="toolbar">
        <li onclick="window.location.href='feedbackDatatable.html'"><img src="../../images/back.png" />返回</li>

    </ul>
</div>
<div id="main" style="position:relative; width: 88%; height: 500px;"></div>
</body>

<script type="text/javascript">

    function init(){
        alert("开始统计");
        let url="../../Device_ServletAction";
        let message={};
        message.Action="StatisticsFeedbackInfo";
        $.post(url,message,function (json){
            if(json.ok===200){
                console.log(json);
                initTable(json);
                alert("统计成功!");
            } else {
                alert("统计失败!");
            }
        });
    }

    function initTable(json){
        let myChart = echarts.init(document.getElementById('main'));
        const option = {
            color: ['#309bde'],
            title: {
                text: 'feedbackInfo Statistic/反馈信息统计'
            },
            tooltip: {},
            legend: {
                data: ['反馈信息']
            },
            xAxis: {
                data: ["反馈总数量", "系统反馈信息数量", "设备反馈信息数量", "用户反馈信息数量"]
            },
            yAxis: {},
            series: [{
                name: '反馈信息',
                type: 'bar',
                data: [json.sumNum, json.系统信息反馈, json.设备信息反馈, json.用户信息反馈 ]
            }]
        };
        myChart.setOption(option);
    }
</script>

</html>